<?php
namespace Admin\Controller;
use Think\Controller;
class AdminVideoController extends Controller {
    public function index(){
        $video = M('video');
        $videoSql = "SELECT * FROM et_video ORDER BY video_order";
        $videoQuery = $video -> query($videoSql);
        $this->assign("videoQuery",$videoQuery);
        $this->display();
    }
    public function add(){
        $this->display();
    }
    public function addinsert(){
    	// var_dump($_POST);
    	// var_dump($_FILES);
    	$video = M('video');
    	$data[] = $_POST;
    	$upload = new \Think\Upload();// 实例化上传类
	    $upload->rootPath  =     './Uploads/'; // 设置附件上传根目录
	    $upload->savePath  =     ''; // 设置附件上传（子）目录
        $time = date('Y-m-d',time());
        
	    // 上传文件 
	    $info   =   $upload->upload();
        var_dump($info);
        $_FILES['video_pic']['name'] = "{$time}/{$info['video_pic']['savename']}";
        $_FILES['video_video']['name'] =  "{$time}/{$info['video_video']['savename']}";
    	$videoSql = "INSERT INTO et_video (
                                            video_name,
                                            video_pic,
                                            video_content,
                                            video_status,
                                            video_del,
                                            video_order,
                                            video_des) 
                                            VALUES (
                                            '".$_POST['video_name']."',
                                            '".$_FILES['video_pic']['name']."',
                                            '".$_FILES['video_video']['name']."',
                                            '".$_POST['video_status']."',
                                            '".$_POST['video_del']."',
                                            '".$_POST['video_order']."',
                                            '')";
        $video -> execute($videoSql);
    }
}